import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-07-23
 * Time: 9:26
 */
public class Test {
    public static void main(String[] args) {
        int[] nums = {0,0,1,1,1,2,2,3,3,4};
    }

    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int j = 0;
        for(int i = m; i < m+n; i++) {
            nums1[i] = nums2[j++];
        }
        Arrays.sort(nums1);
    }

    public int removeDuplicates(int[] nums) {
        int j = 0;
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] != nums[j]){
                nums[++j] = nums[i];
            }
        }
        return j+1;
    }

    public int removeElement(int[] nums, int val) {
        int j = 0;
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] != val) {
                if(nums[j] == val) {
                    nums[j] = nums[i];
                    nums[i] = val;
                }
                j++;
            }
        }
        return j;
    }
}


